<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./Promise.js"></script>

    <script>
      //实例化 Promise 对象
      let p = new Promise((resolve, reject) => {
        //改变 promise 状态的方式
        // resolve("OKOKOKOK");
        reject('Error');
      });

      let result = p.then(
        (v) => {
          console.log(v);
          //1. 返回非 promise 数据
          // return '精神一下~~~'
          //2. 返回 promise 对象
          // return new Promise((resolve, reject) => {
          //   // resolve('Yes');
          //   // reject('NoNoNo')
          // })
          //3. 抛出错误
          // throw 'Error';
        },
        (r) => {
          // console.log(r);
          //返回非 promise 的数据
          // return 123;
          // return ['x','y','z']
          //返回 promise 数据
          // return new Promise((resolve, reject) => {
            // resolve('OK');
            // reject('Error');
          // })
          //抛出错误
          throw '有点问题~~~';
        }
      );

      console.log(result);

    </script>
  </body>
</html>
